//一级路由
import React from "react"

const Index = React.lazy(() => import('../views/Index'))
const Login = React.lazy(() => import('../views/Login'))
const GoCompile = React.lazy(() => import('../views/GoCompile'))
const PictureUpload = React.lazy(() => import('../views/PictureUpload'))
const Search = React.lazy(() => import('../views/Search'))
const Detail = React.lazy(() => import('../views/Detail'))
const ArticleDetail = React.lazy(() => import('../views/ArticleDetail'))
const RankDetail = React.lazy(() => import('../views/RankDetail'))
const ChangeName = React.lazy(() => import('../views/ChangeName'))
// import Index from "../views/Index"
// import Login from "../views/Login"
// import GoCompile from "../views/GoCompile"
// import PictureUpload from "../views/PictureUpload"
// import Search from "../views/Search"
// import Detail from "../views/Detail"
// import ArticleDetail from "../views/ArticleDetail"
// import RankDetail from "../views/RankDetail"


//二级路由

const Home = React.lazy(() => import('../views/index/Home'))
const Classfig = React.lazy(() => import('../views/index/Classfig'))
const Message = React.lazy(() => import('../views/index/Message'))
const My = React.lazy(() => import('../views/index/My'))
// import Home from "../views/index/Home"
// import Classfig from "../views/index/Classfig"
// import Message from "../views/index/Message"
// import My from "../views/index/My"
const router = [
    {
        path: "/index",
        component: Index,
        children: [
            {
                path: "/index/home",
                component: Home,
            },
            {
                path: "/index/classfig",
                component: Classfig,
            },
            {
                path: "/index/message",
                component: Message,
            },
            {
                path: "/index/my",
                component: My,
            },

            {
                path: "/index",
                redirect: "/index/home"
            }
        ]
    },
    {
        path: "/articleDetail",
        component: ArticleDetail,
    },
    {
        path: "/rankDetail",
        component: RankDetail,   
    },
    {
        path: "/login",
        component: Login,
    },
    {
        path: "/goCompile",
        component: GoCompile,
    },
    {
        path: "/pictureUpload",
        component: PictureUpload,
    },
    {
        path: "/search",
        component: Search,
    },
    
    {
        path:'/detail',
        component:Detail
    },
    {
        path:'/changeName',
        component:ChangeName
    },
    {
        path: "/",
        redirect: "/index"
    }
]


export default router